8. Scripting Speed Download



 

8.1 Introduction

You can use Applescript to automate tasks with Speed Download. Using Applescript you can alter many settings, start downloads, monitor their progression and more. There are many potential uses for this. You could write a script that would download a file and then power down the computer. You could then have your computer turn on late at night, when phone calls are cheaper and people won't be trying to call you if you are a modem user or simply because the Internet is less busy at that time and download files by placing the script in your startup items folder.
8.2 Command Reference
This is a complete reference of all the Applescript commands that Speed Download 1.0 supports

AddURL:

Parameters: a list of strings, each a URL of a file to add to the queue.

Returns: nothing

Description: DownloadURL adds the specified urls to the download queue and sets their status to Queued


CancelDownload:

Parameters: a long integer, the DownloadID for an ongoing download you wish to cancel

Returns: an integer. See description for interpretation of this code

Description: Cancels a previously started download.

Possible return values:

0 : The download was successfully cancelled
-4: The downloadID you supplied was invalid : the corresponding download does not exist or has finished.
GetDownloadStatus:
Parameters:  long integer, the DownloadID for the download whose status you wish to know

Returns: a double integer. See description for interpretation of this number

Description: Gets the status of a download. If the return value is positive, then the download has started and the value returned represents the number of bytes that have been received so far. If not,  the download is in a state identified by one of the following (negative)  constants:

-1 : the download has been initiated but data transfer has not yet started
-2 : the download has completed successfully
-3 : the download completed because an error occurred
-5 : the download was cancelled
-4 : the DownloadID you supplied did not reference a download
GetDownloadSize:
Parameters:  long integer, the DownloadID for the download whose size you wish to know

Returns: a double integer. See description for interpretation of this number

Description: Fetches the size in bytes of a file being downloaded. If you call this too early, before the size of the file has been determined the file size returned will be zero. If the information could not be retrieved, a negative error code is returned. The downloadID must reference a download that is still being processed. If the download has finished, kBadDownloadID will be returned.

Possible return values:

-4 : the DownloadID you supplied did not reference an ongoing download
GetStatus:
Parameters: none

Returns: a small integer

Description: GetStatus returns the number of downloads that are currently active
 

SetNumberOfPorts:
Parameters: an integer, the new number of ports

Returns: nothing

Description: Sets the number of ports to be used for future downloads to the value you supply. This does not modify the value set in the Preferences. It will only be used for the current session.

StartQueue:
Parameters: nothing

Returns: nothing

Description: Starts the queue

StopQueue:
Parameters: nothing

Returns: nothing

Description: Stops the queue

GetDownloadURL:
Parameters: long integer, the DownloadID for the active download whose URL you wish to know

Returns: string

Description: Gets the URL for the file the download is associated with. If an error occurs (most likely because you specified an invalid DownloadID) the returned string is empty

GetQueueStatus:
Parameters: nothing

Returns: boolean

Description: returns the activation state of the queue (true if the queue is active, false if it is stopped)

CountQueuedDownloads:
Parameters: nothing

Returns: small integer

Description: returns the number of downloads in the queue whose status is "Queued"

GetActiveDownloads:
Parameters: nothing

Returns: a list of long integers

Description: returns a list containing the DownloadIDs for all currently active downloads

 



[Table of contents] [Previous Page] [Next Page]

Copyright © 2000 Frederick Cheung. All rights reserved